﻿using System;
using System.Diagnostics;

namespace HgAdapter
{
	public class HgAnnotate : HgCommand
	{
		public string Run(string brackedFileName)
		{
			string result;

			string saveCurrentDirectory = Environment.CurrentDirectory;
			Environment.CurrentDirectory = ProjectCommitInfo.Instance.ProjectPath;

			Process hgProcess = Process.Start(HgStatusStartInfo("annotate " + brackedFileName));
			hgProcess.WaitForExit(1000);
			result = hgProcess.StandardOutput.ReadToEnd();

			Environment.CurrentDirectory = saveCurrentDirectory;

			return result;
		}
	}
}
